<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>标题4</title>
<meta name="keywords" content="">
<meta name="description" content="">
<link rel="stylesheet" href="icons/iconfont.css">
<style>
*{margin:0;padding:0;}
	html,body{width:100%;height:100%;}
	body{display:-webkit-box;-webkit-box-orient:vertical;}
	.d0{width:100%;height:50px;display:-webkit-box;-webkit-box-orient:horizontal;background:#ccc;}
	.d1{line-height:50px;-webkit-box-flex:1;padding-left:40px;}
	.p1{display:none;}
	.dq{width:100%;margin-top:20px;}
	.dw{float:left;margin:20px 10px;}
	.dw img{width:245px;height:245px;}
	.i1{cursor:pointer;}
	.dw p{width:245px;height:30px;}
	input{width:500px;height:30px;margin:10px 25%;}
</style>
</head>
<body>
	<input type="search" name="" placeholder="" id= "btn" autofocus required>
</body>
<script type="text/javascript" src="js/jquery-1.10.1.min.js"></script>
<script>
$.ajax({
	type:'get',
	dataType:'json',
	url:'http://datainfo.duapp.com/shopdata/getclass.php',
	success:function(data){
		var d0=$('<div class="d0"></div>')
		$.each(data,function(index){
			var lis=$('<div class="d1"><i class="iconfont i1">'+data[index].icon+'</i><p class="p1">'+data[index].className+'</p></div>')
			d0.append(lis)
			$('body').append(d0);

			
		})


	}
})



function getgoods(classID,pageCode){
$.ajax({
	type:'get',
	url:'http://datainfo.duapp.com/shopdata/getGoods.php',
	dataType:'jsonp',
	data:{classID:classID,pageCode:pageCode},
	success:function(data){
		var dq=$('<div class="dq"></div>')
		$.each(data,function(index){
			// console.log(data[index])
			var img=$('<div class="dw"><img src="'+data[index].goodsListImg+'" alt="" /><p>'+data[index].price+'</p><p>'+data[index].goodsName+'</p></div>');
			// $(".dq").eq(classID).find(".dw").eq(index).html(img);

			dq.append(img)
			$('body').append(dq)
		})
	}


})
}
getgoods(1,0)

// for(k=0;k<13;k++){
// 	getgoods(k,0);
// }

$('#btn').click(function(){
function getgood(pageCode,linenumber){
	$.ajax({
		url:'http://datainfo.duapp.com/shopdata/selectGoodes.php',
		type:'get',
		dataType:'json',
		data:{pageCode:pageCode,linenumber:linenumber}
		success:function(data){
			$.each(data,function(index){
				var search=$('<div><img src="'data[index].goodsListImg+'" alt="" /><p>'+data[index].goodsName+'</p><p>'+data[index].price+'</p></div>')
				$('body').append(search);
			})
		}
	})
	}
	getgood(1,0)
})


</script>
</html>